package gob.inei.enaho.controller.activity;

import util.android.cuestionario.fragment.CuestionarioFragmentAdapter;
import gob.inei.enaho.model.domain.enaho.cuestionario.Enaho01;
import gob.inei.enaho.view.enaho01.Cap100FragmentAdapter;
import gob.inei.enaho.view.enaho01.Cap200FragmentAdapter;
import gob.inei.enaho.view.enaho01.AperturaHogarFragmentAdapter;
import gob.inei.enaho.view.enaho01.AperturaViviendaFragmentAdapter;
import gob.inei.enaho.view.enaho01.Cap200MiembroFragmentAdapter;
import gob.inei.enaho2014.R;
import android.os.Bundle;
import android.view.Menu;

public class Enaho01FragmentActivity 
extends EnahoFragmentActivity
{
	
	private Enaho01 capitulo;
	//private ViviendaService viviendaService = AppContext.getServices().getViviendaService(); 
	
	@Override
	protected CuestionarioFragmentAdapter crearPagerAdapter() {
		Bundle b = this.getIntent().getExtras();		
		String c = b.getString("c");
		String v = b.getString("v");
		String h = b.getString("h");
		
		capitulo = Enaho01.valueOf(b.getString("capitulo"));
		
		switch(capitulo) {
			case APERTURA_VIVIENDA: 
				return new AperturaViviendaFragmentAdapter(this,
						c,v,getSupportFragmentManager());
			case APERTURA_HOGAR: 
				return new AperturaHogarFragmentAdapter(this,
						c,v,h,getSupportFragmentManager());
			case CAP100: 
				return new Cap100FragmentAdapter(this,
						c,v,h,getSupportFragmentManager());
			case CAP200:
				return new Cap200FragmentAdapter(this,
						c,v,h,getSupportFragmentManager());
			case CAP200_Miembro:
				String p201 = b.getString("p201");
				return new Cap200MiembroFragmentAdapter(this,
						c,v,h,p201,getSupportFragmentManager());
			case CAP600:
				break;
			case CAP602:
				break;
			case CAP602A1:
				break;
			case CAP603:
				break;
			case CAP604:
				break;
			case CAP605:
				break;
			case CAP606:
				break;
			case CAP606D:
				break;
			case CAP607:
				break;
			case CAP609:
				break;
			case CAP610:
				break;
			case CAP611:
				break;
			default:
				break;
		}		
		
		return null;
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.enaho_fragment, menu);
		
		if(capitulo==Enaho01.APERTURA_VIVIENDA) {
			menu.findItem(R.id.observaciones).setVisible(false);
		}
		return true;
	}
	
}
